<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('task_uuid', 64)->comment('任务uuid');
            $table->string('shop_uuid', 64)->comment('店铺uuid');
            $table->string('open_id', 64)->comment('发布人');
            $table->unsignedInteger('task_platform')->default(0)->comment('任务所属平台1.美团2.饿了么');
            $table->unsignedInteger('task_status')->default(0)->comment('任务状态1.开启2.关闭3.暂停');
            $table->unsignedInteger('task_type')->default(0)->comment('任务类型1.0元餐2.返利餐');
            $table->unsignedInteger('task_rebate_type')->comment('返利类型:1.指定金额2.按比例');
            $table->unsignedInteger('task_rebate_money')->comment('返利金额:单位分');
            $table->float('task_rebate_ratio')->comment('返利比例:百分比');
            $table->float('task_commission')->default(0)->comment('抽佣比列:百分比');
            $table->unsignedInteger('order_num')->default(0)->comment('可接订单数量');
            $table->json('task_img')->nullable()->comment('任务宣传图');
            $table->text('task_remark')->nullable()->comment('任务备注');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('tasks');
    }
}
